const http =require('http')
const fs =require('fs')
function rander(res,url,status=200){
    res.writeHead(status,{
        "content-type":"text/html;charset=utf-8"
    })
    fs.readFile(path.join(__dirname,url z),'utf-8',(err,data)=>{
        if(err){
            console.log('页面读取失败');
        
        }else{res.end(data)}
    })

if(url==='/home'){
   
}else if(url==='/login'){
    res.writeHead(200,{
        "content-type":"text/html;charset=utf-8"
    })
    fs.readFile(path.join(__dirname,'./static/home/html'),'utf-8',(err,data)=>{
        if(err){
            console.log('页面读取失败');
        
        }else{res.end(data)}
    })
}else{
    res.writeHead(404,{
        "content-type":"text/html;charset=utf-8"
    })
    fs.readFile(path.join(__dirname,'./static/404.html'),'utf-8',(err,data)=>{
        if(err){
            console.log('页面读取失败');
        
        }else{res.end(data)}
    })
}


}

server.listen(80,()=>{
    console.log("http://127.0.0.1")
})